Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top | Next |

Chunk Organization and Data Types

An AIFF or AIFF-C file contains several different types of chunks. For example, there is a Common Chunk that specifies important parameters of the sampled sound, such as its size and sample rate. There is also a Sound Data Chunk that contains the actual audio samples. A chunk consists of some header information followed by some data. The header information consists of a chunk ID number and a number that indicates the size of the chunk data. In general, therefore, a chunk has the structure shown in Figure 1-22 .

Figure 22 The general structure of a chunk

The header information of a chunk has this structure:

TYPE ChunkHeader =
RECORD
    ckID:       ID;             {chunk type ID}
    ckSize:     LongInt;        {number of bytes of data}
END;

The ckID field specifies the chunk type. An ID is a 32-bit concatenation of any four printable ASCII characters in the range ' ' (space character, ASCII value $20) through '~' (ASCII value $7E). Spaces cannot precede printing characters, but trailing spaces are allowed. Control characters are not allowed. You can specify values for the four types of chunks described later by using these constants:

CONST
    FormID                  = 'FORM';       {ID for Form Chunk}
    FormatVersionID         = 'FVER';       {ID for Format Version Chunk}
    CommonID                = 'COMM';       {ID for Common Chunk}
    SoundDataID             = 'SSND';       {ID for Sound Data Chunk}

The ckSize field specifies the size of the data portion of a chunk and does not include the length of the chunk header information.


© 1998 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top | Next |